# Maintainer: Kevin Mihelich <kevin@archlinuxarm.org>

# Armada 510/Dove graphics libraries

buildarch=4

pkgname="marvell-libgfx"
pkgver=0.2.0
pkgrel=6
arch=('armv7h')
url="http://archlinuxarm.org"
license=('Proprietary')
source=("http://archlinuxarm.org/builder/src/marvell-libgfx-0.2.0.tar.gz"
  "http://download.solid-run.com/pub/solidrun/cubox/packages/marvell-opengl/marvell-opengl-hardfp-debug.zip"
  "http://download.solid-run.com/pub/solidrun/cubox/packages/marvell-libgfx/marvell-libgfx-headers-20120713.tar.bz2"
  "profile.sh"
)
provides=('libegl' 'libgles' 'khrplatform-devel')

package() {
  pkgdesc="Armada 510/Dove graphics Libraries"

  install -Dm644 "${srcdir}/${pkgname}-${pkgver}/etc/udev/rules.d/99-galcore.rules" \
    "${pkgdir}/usr/lib/udev/rules.d/99-galcore.rules"

  find include -type f -exec \
    install -Dm644 {} "${pkgdir}/opt/${pkgname}/{}" \;
  ln -s gc_hal.h "${pkgdir}/opt/${pkgname}/include/HAL/aqHal.h"

  cd gc3184-1-mgcc462hd-d
  find -name "*.so" -not -path "*libdirectfb_gal.so" \
    -exec install -Dm755 {} "${pkgdir}/opt/${pkgname}/lib/{}.1" \; \
    -exec ln -s {}.1 "${pkgdir}/opt/${pkgname}/lib/{}" \;
  ln -s libGLES_CM.so.1 "${pkgdir}/opt/${pkgname}/lib/libGLESv1_CM.so"
  ln -s libGLES_CM.so.1 "${pkgdir}/opt/${pkgname}/lib/libGLESv1_CM.so.1"
  ln -s libGLESv2x.so.1 "${pkgdir}/opt/${pkgname}/lib/libGLESv2.so"
  ln -s libGLESv2x.so.1 "${pkgdir}/opt/${pkgname}/lib/libGLESv2.so.1"
  ln -s libGLESv2x.so.1 "${pkgdir}/opt/${pkgname}/lib/libGLESv2.so.2"

  install -d "${pkgdir}"/etc/ld.so.conf.d/
  echo "/opt/${pkgname}/lib" > "${pkgdir}"/etc/ld.so.conf.d/${pkgname}.conf

  install -Dm755 "${srcdir}/profile.sh" "${pkgdir}/etc/profile.d/${pkgname}.sh"
}

md5sums=('6cd584e6feb6a8605662bb2280676f65'
  'd21429fa2d4296f1f4238faff6cca6ca'
  'a381d9d6d0c5beda781a23dea2c3e0ea'
  '9a210fbfad0e13d775800b06946d8abd')
